/*
 * #%L
 * java model
 * %%
 * Copyright (C) 2009 - 2011 prefabware.com Stefan Isele
 * %%
 * All Rights Reserved.
 * This program is dual-licensed under the GNU General Public license
 * or a commercial license.
 * You may select to use one or the other of these licenses.
 * To obtain a commercial license please contact Stefan Isele at www.stefan-isele.de
 * Any modifications to this file must keep this entire header intact.
 * Redistribution, except as permitted by the selected license, is prohibited.
 * #L%
 */
package com.prefabware.jmodel;

import java.util.ArrayList;
import java.util.List;

import com.prefabware.commons.Condition;
import com.prefabware.commons.Message;
import com.prefabware.commons.QualifiedName;

/**
 * @author sisele_job
 * 
 */
public class JInterface extends JTypeWithFields {
	public JInterface(QualifiedName qn, JTypeDeclaration declaration) {
		super(qn, declaration);
		this.extends_ = new ArrayList<JInterface>();
	}

	private List<JInterface> extends_;

	public List<JInterface> getExtends() {
		return extends_;
	}

	public JInterface add(JInterface arg0) {
		extends_.add(arg0);
		return this;
	}

	@Override
	public void add(JField field) {
		Condition.isTrue(field.getDeclaration().isStatic(),
				Message.format("interfaces can have static fields only!%n field=%s", field));
		super.add(field);
	}
	@Override
	public String getJavaKeyword() {
		return "class";
	}
}
